home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 2510.ZIP / TRSOURCE.EXE / _TR_LDM.C < prev    next >
C/C++ Source or Header  |  1990-10-22  |  539b  |  27 lines

  1. /*********
  2. *  _tr_ldm.c
  3. *
  4. *  by Tom Rettig
  5. *
  6. * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  7. *
  8. *  Syntax: _tr_ldm( <month>, <year> )
  9. *  Return: int last day of the month
  10. *          zero if invalid <month> or <year>
  11. ********/
  12.  
  13. #include "trlib.h"
  14.  
  15. int _tr_ldm(month,year)
  16. int month, year;
  17. {
  18.    static int lday[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
  19.  
  20.    if ( ISYEAR(year) && ISMONTH(month) )
  21.       return( (ISLPYR(year) && month==2) ? 29 : lday[month] );
  22.    else
  23.       return( 0 );
  24. }
  25.  
  26.  
  27.